package com.example.demo.controller.AuthorControl;

import com.example.demo.entity.BackResponseEntity;
import com.example.demo.entity.requestJson.AForgetPwdReq;
import com.example.demo.entity.requestJson.AUpdatePwdReq;
import com.example.demo.entity.requestJson.AuthorInfoReq;
import com.example.demo.entity.requestJson.LoginReq;
import com.example.demo.entity.responseJson.LoginRes;
import com.example.demo.service.ALoginService;
import com.example.demo.service.APersonalSettingsService;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author : 杨丽辉
 * @date : 2021/2/26 15:54
 * @description:
 */
@RestController
@RequestMapping("/author/settings")
@Api(value = "个人设置接口", tags = "个人设置接口")

public class APersonalSeetingsController {
    @Autowired
    private APersonalSettingsService aPersonalSettingsService;

    @ApiOperation(value = "作者修改个人基本信息", notes = "authorId为必传，修改信息必传不能为空")
    @ApiOperationSupport(author = "杨")
    @ApiResponses(
            @ApiResponse(code = 200, message = "处理成功")
    )
    @PostMapping("/updateinfo")
    public BackResponseEntity<Object> updateAuthorInfo(@RequestBody AuthorInfoReq authorInfoReq) {
        return aPersonalSettingsService.updateAuthorInfo(authorInfoReq);
    }

    @ApiOperation(value = "作者修改密码", notes = "")
    @ApiOperationSupport(author = "杨")
    @ApiResponses(
            @ApiResponse(code = 200, message = "处理成功")
    )
    @PostMapping("/updatepwd")
    public BackResponseEntity<Object> updatePwd(@RequestBody AUpdatePwdReq aUpdatePwdReq) {
        return aPersonalSettingsService.updatePwd(aUpdatePwdReq);
    }

    @ApiOperation(value = "作者忘记密码", notes = "")
    @ApiOperationSupport(author = "杨")
    @ApiResponses(
            @ApiResponse(code = 200, message = "处理成功")
    )
    @PostMapping("/forgetpwd")
    public BackResponseEntity<Object> forgetPwd(@RequestBody AForgetPwdReq aForgetPwdReq) {
        return aPersonalSettingsService.forgetPwd(aForgetPwdReq);
    }
}
